JavaServer

Frequently Asked Questions (FAQ) About Servlets


Documentation / Developer Docs / Administrator Docs / Index / FAQ

The Servlets FAQ has the following questions:

  1. How do I pass arguments to the servlets?
  2. How long do servlets last?
  3. What servlets are currently part of the server?
  4. Why can't I compile a servlet?
  5. How do I set multiple properties?
  6. What is passed as ServletRequest for servlets invoked as server side include?

How do I pass arguments to the servlets?

Arguments to the servlets can be passed at two levels.

  1. When a client is invoking the servlet, the client can pass the arguments as part of URL in form of name/value pairs in the query string portion of the URL. If a tag is used in the html language to invoke the servlet, the arguments can be passed through the param name construct:

    <servlet code="servlet_name" stock_symbol="SUNW">

  2. The server administrator/web-master can pass arguments to the servlet at the loading/intialization time by specifying the arguments as part of the server configuration.

How long do servlets last?

Once activated, servlets live on until the server lives or until the destroy method is called on the servlet by the server. The servlets with association in servlet aliases, unmapping the alias will destroy the servlet, and subsequent access to the servlet will reload the servlet.

What servlets are currently part of the server?

See the Internal Servlets page, and the Sample Servlets page for information on some of the available servlets. Also look in the server_root/servlets directory of the release for more servlets.

Why can't I compile a servlet?

Make sure that your CLASSPATH is set to include the JavaServer classes. This can be done at the command line (using java -classpath ....) or else in the environment variable.

How do I set multiple properties?

The following is the proper syntax:

What is passed as ServletRequest for servlets invoked as server side include?

SSIncludeServlet will clone its ServletRequest, and substitute the parameters embedded in the tag.


Top
java-server-feedback@java.sun.com